package com.itheima.health.jobs;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.health.pojo.OrderSetting;
import com.itheima.health.service.OrderSettingService;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RestController;

import java.sql.ResultSet;
import java.util.Calendar;
import java.util.Date;

/**
 * @Author HC Zhang
 * @Date created in 2020/1/2
 * @description 定时任务:清除预约数据
 * @Version 1.0
 */
@RestController
@Slf4j
public class ClearAppointmentData {

        @Reference
        private OrderSettingService orderSettingSevice;

     public void ClearAppointment() {
          log.info("开始清理预约数据");


         Calendar today = Calendar.getInstance();

         today.add(Calendar.DAY_OF_MONTH,-15);
         Date date1 = today.getTime();

         orderSettingSevice.deleteNumberByDate(date1);
         log.info("[清理预约数据完成]");



    }

}
